package com.github.catvod.spider.merge;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.Nullable;

public abstract class fa implements Cloneable {
  static final List<fa> h = Collections.emptyList();
  
  @Nullable
  fa V0;
  
  int j;
  
  private void l(int paramInt) {
    List<fa> list = iU();
    while (paramInt < list.size()) {
      ((fa)list.get(paramInt)).FE(paramInt);
      paramInt++;
    } 
  }
  
  public fa BQ(fa paramfa) {
    R2.u(paramfa);
    R2.u(this.V0);
    this.V0.V0(this.j, new fa[] { paramfa });
    return this;
  }
  
  @Nullable
  public fa C4() {
    return this.V0;
  }
  
  public void F(String paramString) {
    R2.u(paramString);
    t(paramString);
  }
  
  protected fa F8(@Nullable fa paramfa) {
    try {
      int i;
      fa fa1 = (fa)super.clone();
      fa1.V0 = paramfa;
      if (paramfa == null) {
        i = 0;
      } else {
        i = this.j;
      } 
      fa1.j = i;
      return fa1;
    } catch (CloneNotSupportedException cloneNotSupportedException) {
      throw new RuntimeException(cloneNotSupportedException);
    } 
  }
  
  protected void FE(int paramInt) {
    this.j = paramInt;
  }
  
  @Nullable
  public fa GM() {
    fa fa1 = this.V0;
    if (fa1 == null)
      return null; 
    List<fa> list = fa1.iU();
    int i = this.j + 1;
    return (list.size() > i) ? list.get(i) : null;
  }
  
  protected void H9(fa paramfa) {
    R2.u(paramfa);
    fa fa1 = this.V0;
    if (fa1 != null)
      fa1.rd(this); 
    this.V0 = paramfa;
  }
  
  public abstract QF I();
  
  @Nullable
  public fa Ig() {
    fa fa1 = this.V0;
    return (fa1 == null) ? null : ((this.j > 0) ? fa1.iU().get(this.j - 1) : null);
  }
  
  protected void LW(Appendable paramAppendable) {
    bY.V0(new Tw(paramAppendable, n.h(this)), this);
  }
  
  abstract void Og(Appendable paramAppendable, int paramInt, HZ.Tw paramTw);
  
  public boolean PD() {
    boolean bool;
    if (this.V0 != null) {
      bool = true;
    } else {
      bool = false;
    } 
    return bool;
  }
  
  public abstract String PU();
  
  public List<fa> Qy() {
    if (u() == 0)
      return h; 
    List<fa> list = iU();
    ArrayList<fa> arrayList = new ArrayList(list.size());
    arrayList.addAll(list);
    return Collections.unmodifiableList(arrayList);
  }
  
  abstract void R(Appendable paramAppendable, int paramInt, HZ.Tw paramTw);
  
  protected void T(fa paramfa) {
    paramfa.H9(this);
  }
  
  public void To(fa paramfa) {
    R2.u(paramfa);
    R2.u(this.V0);
    this.V0.V(this, paramfa);
  }
  
  protected void V(fa paramfa1, fa paramfa2) {
    boolean bool;
    if (paramfa1.V0 == this) {
      bool = true;
    } else {
      bool = false;
    } 
    R2.j(bool);
    R2.u(paramfa2);
    fa fa1 = paramfa2.V0;
    if (fa1 != null)
      fa1.rd(paramfa2); 
    int i = paramfa1.j;
    iU().set(i, paramfa2);
    paramfa2.V0 = this;
    paramfa2.FE(i);
    paramfa1.V0 = null;
  }
  
  protected void V0(int paramInt, fa... paramVarArgs) {
    R2.u(paramVarArgs);
    if (paramVarArgs.length == 0)
      return; 
    List<fa> list = iU();
    int j = 0;
    fa fa1 = paramVarArgs[0].C4();
    if (fa1 != null && fa1.u() == paramVarArgs.length) {
      List<fa> list1 = fa1.iU();
      int m = paramVarArgs.length;
      while (true) {
        int n = m - 1;
        if (m > 0) {
          if (paramVarArgs[n] != list1.get(n)) {
            m = 0;
            break;
          } 
          m = n;
          continue;
        } 
        m = 1;
        break;
      } 
      if (m != 0) {
        fa1.n();
        list.addAll(paramInt, Arrays.asList(paramVarArgs));
        m = paramVarArgs.length;
        while (true) {
          j = m - 1;
          if (m > 0) {
            (paramVarArgs[j]).V0 = this;
            m = j;
            continue;
          } 
          l(paramInt);
          return;
        } 
      } 
    } 
    R2.I((Object[])paramVarArgs);
    int k = paramVarArgs.length;
    for (int i = j; i < k; i++)
      T(paramVarArgs[i]); 
    list.addAll(paramInt, Arrays.asList(paramVarArgs));
    l(paramInt);
  }
  
  public fa W(int paramInt) {
    return iU().get(paramInt);
  }
  
  @Nullable
  public HZ b() {
    fa fa1 = z();
    if (fa1 instanceof HZ) {
      fa1 = fa1;
    } else {
      fa1 = null;
    } 
    return (HZ)fa1;
  }
  
  public boolean equals(Object paramObject) {
    boolean bool;
    if (this == paramObject) {
      bool = true;
    } else {
      bool = false;
    } 
    return bool;
  }
  
  @Nullable
  public final fa f() {
    return this.V0;
  }
  
  public String h(String paramString) {
    R2.BQ(paramString);
    return (!y() || !I().n(paramString)) ? "" : ZG.n(oC(), I().F8(paramString));
  }
  
  public int hr() {
    return this.j;
  }
  
  public boolean i4(String paramString) {
    R2.u(paramString);
    if (!y())
      return false; 
    if (paramString.startsWith("abs:")) {
      String str = paramString.substring(4);
      if (I().n(str) && !h(str).isEmpty())
        return true; 
    } 
    return I().n(paramString);
  }
  
  protected abstract List<fa> iU();
  
  public String j(String paramString) {
    R2.u(paramString);
    if (!y())
      return ""; 
    String str = I().F8(paramString);
    return (str.length() > 0) ? str : (paramString.startsWith("abs:") ? h(paramString.substring(4)) : "");
  }
  
  protected void j5(Appendable paramAppendable, int paramInt, HZ.Tw paramTw) {
    paramAppendable.append('\n').append(ZG.F8(paramInt * paramTw.oC()));
  }
  
  public abstract fa n();
  
  public void nf() {
    R2.u(this.V0);
    this.V0.rd(this);
  }
  
  public abstract String oC();
  
  public fa oq() {
    fa fa1 = F8(null);
    LinkedList<fa> linkedList = new LinkedList();
    linkedList.add(fa1);
    while (!linkedList.isEmpty()) {
      fa fa2 = linkedList.remove();
      int i = fa2.u();
      for (byte b = 0; b < i; b++) {
        List<fa> list = fa2.iU();
        fa fa3 = ((fa)list.get(b)).F8(fa2);
        list.set(b, fa3);
        linkedList.add(fa3);
      } 
    } 
    return fa1;
  }
  
  public fa q(String paramString1, String paramString2) {
    paramString1 = n.V0(this).q().h(paramString1);
    I().LW(paramString1, paramString2);
    return this;
  }
  
  protected void rd(fa paramfa) {
    boolean bool;
    if (paramfa.V0 == this) {
      bool = true;
    } else {
      bool = false;
    } 
    R2.j(bool);
    int i = paramfa.j;
    iU().remove(i);
    l(i);
    paramfa.V0 = null;
  }
  
  protected abstract void t(String paramString);
  
  public String toString() {
    return w4();
  }
  
  public abstract int u();
  
  public List<fa> v() {
    fa fa1 = this.V0;
    if (fa1 == null)
      return Collections.emptyList(); 
    List<fa> list = fa1.iU();
    ArrayList<fa> arrayList = new ArrayList(list.size() - 1);
    for (fa fa2 : list) {
      if (fa2 != this)
        arrayList.add(fa2); 
    } 
    return arrayList;
  }
  
  public String w4() {
    StringBuilder stringBuilder = ZG.V0();
    LW(stringBuilder);
    return ZG.t(stringBuilder);
  }
  
  protected abstract boolean y();
  
  void yx() {}
  
  public fa z() {
    fa fa1 = this;
    while (true) {
      fa fa2 = fa1.V0;
      if (fa2 != null) {
        fa1 = fa2;
        continue;
      } 
      return fa1;
    } 
  }
  
  private static class Tw implements aC {
    private final HZ.Tw V0;
    
    private final Appendable h;
    
    Tw(Appendable param1Appendable, HZ.Tw param1Tw) {
      this.h = param1Appendable;
      this.V0 = param1Tw;
      param1Tw.W();
    }
    
    public void V0(fa param1fa, int param1Int) {
      try {
        param1fa.Og(this.h, param1Int, this.V0);
        return;
      } catch (IOException iOException) {
        throw new zx(iOException);
      } 
    }
    
    public void h(fa param1fa, int param1Int) {
      if (!param1fa.PU().equals("#text"))
        try {
          param1fa.R(this.h, param1Int, this.V0);
        } catch (IOException iOException) {
          throw new zx(iOException);
        }  
    }
  }
}


/* Location:              /Users/hetaiyi/Desktop/my/tech/java/study/aa/temp/temp.jar!/com/github/catvod/spider/merge/fa.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */